<style scoped src="./index.scss" lang="scss" rel="stylesheet/scss"></style>
<template src="./index.html"></template>
<script>
export default {
  mixins: [Vue.prototype.$vFN.Mixins.Base, Vue.prototype.$vFN.Mixins.Edit],
  components: {},
  data() {
    return {
      appWindow: window,
      form: {
        // 页面名称
        page_name: "页面名称",
        // 分红
        bonus_name: "分红",
        // 团队
        team_name: "团队",
        // 感恩奖
        grade_name: "感恩奖",
        // 育人奖
        educate_name: "育人奖",
        // 平级奖
        equal_name: "平级奖",
        // 越级奖
        transcend_name: "越级奖",
        // 队长
        team_leader: "队长",
      },

      load: true,
    };
  },
  methods: {
    // 验证 
    validate() {
      return new Promise((resolve, reject) => {
        this.$refs["editForm"].validate((valid) => {
            valid ? resolve(true) : resolve(false)
        });
      });
    },
    async sum() {
      if (!await this.validate()) {
        return
      }
      this.load = true;
      let res = await this.$vFN.Http.post({
        url: "plugin/team-dividend/admin/setting/setShowCharacter",
        data: this.form,
      }, window);
      if(res.code == 200) {
        this.$vFN.Tools.messageSuccess("操作成功")
        this.getData();
      }
    },
    async getData() {
      let res = await this.$vFN.Http.post({
        url: "plugin/team-dividend/admin/setting/getBase",
      }, window);
      if(res.data.character_set != null) {
        this.form = res.data.character_set;
      }
      this.load = false;
    },
    // 初始化
    async init() {
      this.getData();
    },
  },
  mounted() {
    this.init();
  },
  activated() {},
};
</script>